<template>
	<view class="box">
		<view class="tecImg">
			<view class="img">
				<image src="../../static/logo.png" mode=""></image>
			</view>
			<text>程玉楼</text>
		</view>
		<view class="state">
			<text class="title">当前状态:</text>
			<text class="cont">可预约</text>
			<view class="appointmentTime">
				<text class="title">可预约时间:</text>
				<view class="dateChoose">
					<picker mode="date" :value="date" start="2015-09-01" end="2020-09-01" @change="DateChange">
						<view class="picker">
							{{date}}∨
						</view>
					</picker>
				</view>
				<view class="dateChoose">
					<picker :range="array" :value="index" @change="bindPickSort">
						<view>{{array[index]}}∨</view>
					</picker>
				</view>
			</view>
			<view class="price">
				<text class="title">价格:</text>
				<text class="priceA">￥1600</text>
			</view>
		</view>
		<view class="tecIntroduce">
			<h3>技师介绍</h3>
			<text>1987年出生，获得整数，获得整数获得整数获得整数获得整数获得整数获得整数获得整数获得整数获得整数获得整数获得整数获得整数获得整数</text>
		</view>
		<view class="evaluationList">
			<view class="">
				评价列表：
			</view>
			<text @click="lookmore">查看更多</text>

		</view>
		<view class="comment" v-for="(res, index) in commentList" :key="res.id">
			<view class="left"><image :src="res.url" mode="aspectFill"></image></view>
			<view class="right">
				<view class="top">
					<view class="name">{{ res.name }}</view>
					<view class="like" :class="{ highlight: res.isLike }">
						<view class="num">{{ res.likeNum }}</view>
						<u-icon v-if="!res.isLike" name="thumb-up" :size="30" color="#9a9a9a" @click="getLike(index)"></u-icon>
						<u-icon v-if="res.isLike" name="thumb-up-fill" :size="30" @click="getLike(index)"></u-icon>
					</view>
				</view>
				<view class="content">{{ res.contentText }}</view>
				<view class="reply-box">
					<view class="item" v-for="(item, index) in res.replyList" :key="item.index">
						<view class="username">{{ item.name }}</view>
						<view class="text">{{ item.contentStr }}</view>
					</view>
					<view class="all-reply" @tap="toAllReply" v-if="res.replyList != undefined">
						共{{ res.allReply }}条回复
						<u-icon class="more" name="arrow-right" :size="26"></u-icon>
					</view>
				</view>
				<view class="bottom">
					{{ res.date }}
					<view class="reply">回复</view>
				</view>
			</view>
		</view>

		<!-- 确认预约弹出框 -->
		<u-modal v-model="visible" :content="techtext" title="预约服务确认" :show-cancel-button="true">
		</u-modal>

		<!-- 底部 -->
		<view class="position">
			<view class="">
				加入购物车
			</view>
			<view class="" @click="yuyue">
				预约
			</view>
		</view>
		<view style="width: 100%;height: 120rpx;">

		</view>
	</view>
</template>

<script>
	import uniEvaluate from '../../components/xiujun-evaluate/uni-evaluate.vue';
	export default {
		data() {
			return {
				techtext:'确认预约这名技师的按摩技师',//模态框内容
				technicianid:'',//技师id
				commentList: [
				{
					id: 1,
					name: '叶轻眉',
					date: '12-25 18:58',
					contentText: '我不信伊朗会没有后续反应，美国肯定会为今天的事情付出代价的',
					url: 'https://cdn.uviewui.com/uview/template/SmilingDog.jpg',
					allReply: 12,
					likeNum: 33,
					isLike: false,
					replyList: [
						{
							name: 'uview',
							contentStr: 'uview是基于uniapp的一个UI框架，代码优美简洁，宇宙超级无敌彩虹旋转好用，用它！'
						},
						{
							name: '粘粘',
							contentStr: '今天吃什么，明天吃什么，晚上吃什么，我只是一只小猫咪为什么要烦恼这么多'
						}
					]
				},
				{
					id: 2,
					name: '叶轻眉1',
					date: '01-25 13:58',
					contentText: '我不信伊朗会没有后续反应，美国肯定会为今天的事情付出代价的',
					allReply: 0,
					likeNum: 11,
					isLike: false,
					url: 'https://cdn.uviewui.com/uview/template/niannian.jpg',
				},
				{
					id: 3,
					name: '叶轻眉2',
					date: '03-25 13:58',
					contentText: '我不信伊朗会没有后续反应，美国肯定会为今天的事情付出代价的',
					allReply: 0,
					likeNum: 21,
					isLike: false,
					allReply: 2,
					url: '../../../static/logo.png',
					replyList: [
						{
							name: 'uview',
							contentStr: 'uview是基于uniapp的一个UI框架，代码优美简洁，宇宙超级无敌彩虹旋转好用，用它！'
						},
						{
							name: '豆包',
							contentStr: '想吃冰糖葫芦粘豆包，但没钱5555.........'
						}
					]
				},
				{
					id: 4,
					name: '叶轻眉3',
					date: '06-20 13:58',
					contentText: '我不信伊朗会没有后续反应，美国肯定会为今天的事情付出代价的',
					url: 'https://cdn.uviewui.com/uview/template/SmilingDog.jpg',
					allReply: 0,
					likeNum: 150,
					isLike: false
				}
			],   //评论列表
				close:false,//点击遮罩是否关闭
				visible: false,//弹窗控制
				date: '2018-12-25',
				array: ['综合排序', '距离', '星级', '日本'],
				index: 0,
				test: [{
						user_name: '111',
						rate: 3,
						create_time: '2017/1/1',
						content: 'ssss'
					},
					{
						user_name: '111',
						rate: 3,
						create_time: '2017/1/1',
						content: 'ssss'
					}
				],
				page:1,//评价页码
			}
		},
		onLoad(option) {
			this.technicianid = option.id
			this.gettechniciandetails()
		},
		methods: {
			//获取技师详情
			gettechniciandetails(){
				var that = this
				var data = {
				}
				var http = '/api/user/massagist/get/' + that.technicianid + '?limit=' + 1 + '&page=' + that.page
				that.$http(http, 'GET', data).then((res) => {
					console.log('技师详情参数', res.data.data.list)
				})
			},
			// 点赞
			getLike(index) {
				this.commentList[index].isLike = !this.commentList[index].isLike;
				if (this.commentList[index].isLike == true) {
					this.commentList[index].likeNum++;
				} else {
					this.commentList[index].likeNum--;
				}
			},
			//确认预约
			yuyue(){
				this.visible = !this.visible
			},
			//查看更多评论
			lookmore() {
				uni.navigateTo({
					url: "../evaluate/evaluate"
				})
			},
			DateChange(e) {
				this.date = e.detail.value
			},
			bindPickSort: function(e) {
				console.log('picker发送选择改变，携带值为', e.target.value)
				this.index = e.target.value
			},
		},
	}
</script>

<style lang="scss">
	.box {
		width: 750rpx;

		.tecImg {
			width: 100%;
			height: 250rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			flex-direction: column;

			.img {
				width: 150rpx;
				height: 150rpx;

				image {
					width: 100%;
					height: 100%;
				}
			}

			text {
				font-size: 28rpx;
				font-weight: bold;
				margin-top: 20rpx;
			}
		}

		.state {
			width: 750rpx;
			padding: 20rpx;
			border-bottom: 2px solid #CECECE;

			.title {
				font-size: 28rpx;
				font-weight: bold;
				margin-bottom: 10rpx;
				color: #333;
			}

			.cont {
				margin-left: 20rpx;
				font-size: 25rpx;
				color: #8E8E8E;
				line-height: 40rpx;
			}

			.appointmentTime {
				margin-top: 20rpx;

				.dateChoose {
					margin-left: 20rpx;
					display: inline-block;
					border: 1px solid #ccc;
					width: 200rpx;
					height: 50rpx;
					text-align: center;
					line-height: 50rpx;
				}
			}

			.price {
				margin-top: 20rpx;

				.priceA {
					margin-left: 20rpx;
					color: red;
					font-size: 30rpx;
					font-weight: bold;
				}
			}

		}

		.tecIntroduce {
			padding: 20rpx;
			border-bottom: 2px solid #CECECE;

			text {
				font-size: 25rpx;
				color: #8E8E8E;
				line-height: 40rpx;
			}
		}

		.evaluationList {
			padding: 20rpx;
			box-sizing: border-box;
			border-bottom: 2px solid #CECECE;
			display: flex;
			justify-content: space-between;

			h3 {
				font-size: 28rpx;
				font-weight: bold;
				margin-bottom: 10rpx;
			}
		}


	}


	//底部
	.position {
		width: 100%;
		height: 100rpx;
		background-color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: space-around;
		position: fixed;
		bottom: 0;
		left: 0;
		border-top: 1rpx solid #a3a3a3;
	}

	.position view {
		width: 30%;
		height: 80rpx;
		border-radius: 10rpx;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.position view:nth-child(1) {
		background-color: #f49c1c;
	}

	.position view:nth-child(2) {
		background-color: #eb673f;
	}
	
	// 模态框按钮
	.modelbotton{
		border-radius: 50rpx;
		background-color: #eb673f;
		color: #FFFFFF;
		width: 50%;
		height: 80rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		margin: 40rpx auto 20rpx;
	}
	
	
	//评论
	.comment {
		display: flex;
		padding: 30rpx;
		.left {
			image {
				width: 64rpx;
				height: 64rpx;
				border-radius: 50%;
				background-color: #f2f2f2;
			}
		}
		.right {
			flex: 1;
			padding-left: 20rpx;
			font-size: 30rpx;
			.top {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-bottom: 10rpx;
				.name {
					color: #5677fc;
				}
				.like {
					display: flex;
					align-items: center;
					color: #9a9a9a;
					font-size: 26rpx;
					.num {
						margin-right: 4rpx;
						color: #9a9a9a;
					}
				}
				.highlight {
					color: #5677fc;
					.num {
						color: #5677fc;
					}
				}
			}
			.content {
				margin-bottom: 10rpx;
			}
			.reply-box {
				background-color: rgb(242, 242, 242);
				border-radius: 12rpx;
				.item {
					padding: 20rpx;
					border-bottom: solid 2rpx $u-border-color;
					.username {
						font-size: 24rpx;
						color: #999999;
					}
				}
				.all-reply {
					padding: 20rpx;
					display: flex;
					color: #5677fc;
					align-items: center;
					.more {
						margin-left: 6rpx;
					}
				}
			}
			.bottom {
				margin-top: 20rpx;
				display: flex;
				font-size: 24rpx;
				color: #9a9a9a;
				.reply {
					color: #5677fc;
					margin-left: 10rpx;
				}
			}
		}
	}
</style>
